﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class newsmessage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string s = Session["subject"].ToString();
        string str = "SELECT subject,sender,content ,message_time FROM  messagebox where subject='" + s + "';";
        DataSet ds = new DataSet();
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["medical"].ConnectionString);
        con.Open();
        SqlDataAdapter sda = new SqlDataAdapter(str,con);
        SqlCommand cmd = new SqlCommand(str, con);
        cmd.ExecuteNonQuery();
        sda.Fill(ds);
        lel1.Text = ds.Tables[0].Rows[0][0].ToString();
        lel3.Text = ds.Tables[0].Rows[0][1].ToString();
        lel5.Text = ds.Tables[0].Rows[0][2].ToString();
        lel6.Text = ds.Tables[0].Rows[0][3].ToString();

        //sda.Fill(ds);
        ////this.ListBox1.DataSource=ds;
        ////this.ListBox1.DataTextField = "content";
        ////this.ListBox1.DataBind(); 
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        this.Response.Write(@"<script>top.close()</script>");   
    }
}
